#include <iostream>
using namespace std;

int main() {
	int arr [100];
	int length =0;
	for(int i=0;;i++){
		cin >> arr[i];
		length++;
		if(arr[i]==0) break;
	} 
	for (int i = length-1; i >0; i--) {
		cout << arr[i-1] << " ";
	}
	
}
